package com.hezuti.sns.action;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;

import com.hezuti.common.action.PageAction;

public class TestAction extends PageAction {
    String       str;
    List<String> newslist = new ArrayList<String>();
    
    public String testStruts() {
	
	System.out.println(str);
	
	try {
	    this.getPage().setTotalCount(50);
	} catch (Exception e) {
	    e.printStackTrace();
	}
	return SUCCESS;
    }

    public String testPage() {

	System.out.println(str);
	List<String> list = new ArrayList<String>();
	for(int i=1;i<50;i++){
	    list.add(i+""+i+""+i+""+i+""+i+""+i+""+i+""+i+"");
	}
	this.getPage().setTotalCount(list.size());
	int curPageNo = this.getPage().getCurrentPageNo();
	int size = this.getPage().getPageSize();
	for (int j = (curPageNo - 1) * size; j < curPageNo * size; j++) {
	    if (list != null && j < list.size()) {
		newslist.add(list.get(j));
	    }
	}
	return "success";

    }

    public String getStr() {
	return str;
    }

    public void setStr(String str) {
	this.str = str;
    }

    public List<String> getNewslist() {
	return newslist;
    }

    public void setNewslist(List<String> newslist) {
	this.newslist = newslist;
    }
    

}
